#!/usr/bin/env bash

mainfile=BS-*.c
echo $old
awk '
{
    if(finish)
    {
        print;
    }
    else
    {
        if(/static struct tmdsptchtbl_t/)
        {
            finish=1;
            for(i in svcs)
                print svcs[i];
            print "";
            print;
        }
        else if(/extern void SVC_/)
            svcs[count++]=$0;
        else
            print;
    }
}
' $mainfile > _$mainfile 
mv _$mainfile $mainfile
g++ $@
